<template>
	<view class="">
    <!-- <button @click="jump">111</button> -->
		<web-view v-if="url" :src="url"></web-view>
	</view>
</template>

<script>
  import {
  	mapGetters,
  } from 'vuex';
	export default {
    onLoad(options) {
      options.url = '`'+options.url+'`'
      this.url = eval(options.url);
      
      const pages = getCurrentPages();
      const prevPage = pages[pages.length - 2]; // 上一页
      
      if (!prevPage) {
        window.history.back()
        return;
      }
      if (options.jump) {
        this.openExternalLink();
      }
    },
    computed: {
    	...mapGetters([
    		'userInfo'
    	])
    },
		data() {
			return {
				url:''
			}
		},
    methods: {
      openExternalLink() {
        // 使用window.open打开外部链接
        if (window.open) {
          window.open(this.url, '_self');
        } else {
          // 兼容处理
          window.location.href = this.url;
        }
      },
      jump() {
        window.open(this.url, '_self')
      }
    },
	}
</script>

<style lang="scss" scoped>
	
</style>
